package com.lingxu.base.system.orgManage.controller;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.base.system.orgManage.entity.SysUserMenu;
import com.lingxu.base.system.orgManage.service.SysUserMenuOldService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Title: SysUserMenuController
 * @Package: com.lingxu.base.system.orgManage.controller
 * @Author: ysj闫世杰
 * @Email: 1105324813@qq.com
 * @Date: Created in 2022/6/21 10:16
 * @Description:
 * @Version: 1.0.0
 */
@Slf4j
@Api(tags = "用户权限配置")
@RestController
@RequestMapping("/user/menu")
public class SysUserMenuOldController {

    @Autowired
    private SysUserMenuOldService sysUserMenuOldService;

    /**
     * @Author ysj闫世杰
     * @Description 查询未分配权限
     * @Date 2022/6/28 16:00
     * @Param: orgId
     * @return com.lingxu.base.common.api.vo.Result
     **/
//    @RequestMapping(value = "/findNotExistsOrg",method = RequestMethod.GET)
//    public Result findNotExistsByOrgId(String orgId){
//        return sysUserMenuService.findNotExistsByOrgId(orgId);
//    }
//
//    /**
//     * @Author ysj闫世杰
//     * @Description 查询已分配权限
//     * @Date 2022/6/28 16:46
//     * @Param: orgId
//     * @return com.lingxu.base.common.api.vo.Result
//     **/
//    @RequestMapping(value = "/findExistsByOrgId",method = RequestMethod.GET)
//    public Result findExistsByOrgId(String orgId){
//        return sysUserMenuService.findExistsByOrgId(orgId);
//    }

//    /**
//     * @Author ysj闫世杰
//     * @Description 单位绑定菜单
//     * @Date 2022/6/28 16:55
//     * @Param: orgMenus
//     * @return com.lingxu.base.common.api.vo.Result
//     **/
//    @RequestMapping(value = "/addOrgBindMenu",method = RequestMethod.POST)
//    public Result addOrgBindMenu(@RequestBody List<SysOrgMenu> orgMenus){
//        return sysUserMenuService.addOrgBindMenu(orgMenus);
//    }

//    /**
//     * @Author ysj闫世杰
//     * @Description 单位移除菜单
//     * @Date 2022/6/28 16:57
//     * @Param: orgMenus
//     * @return com.lingxu.base.common.api.vo.Result
//     **/
//    @RequestMapping(value = "/removeOrgMenu",method = RequestMethod.POST)
//    public Result removeOrgMenu(@RequestBody List<SysOrgMenu> orgMenus){
//        return sysUserMenuService.removeOrgMenu(orgMenus);
//    }

    /**
     * @Author ysj闫世杰
     * @Description 查询用户未分配权限
     * @Date 2022/6/30 9:42
     * @Param: userId
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping("/findNotExistsByUser")
    public Result findNotExistsByUser(String userId){
        return sysUserMenuOldService.findNotExistsByUser(userId);
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询用户已分配权限
     * @Date 2022/6/30 9:43
     * @Param: userId
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findExistsByUser",method = RequestMethod.GET)
    public Result findExistsByUser(String userId){
        return sysUserMenuOldService.findExistsByUser(userId);
    }

    /**
     * @Author ysj闫世杰
     * @Description 新增用户权限
     * @Date 2022/6/30 9:43
     * @Param: sysUserMenu
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/addUserBindMenu",method = RequestMethod.POST)
    public Result addUserBindMenu(@RequestBody List<SysUserMenu> sysUserMenu){
        return sysUserMenuOldService.addUserBindMenu(sysUserMenu);
    }

    /**
     * @Author ysj闫世杰
     * @Description 移除用户权限
     * @Date 2022/6/30 9:43
     * @Param: sysUserMenu
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/removeUserMenu",method = RequestMethod.POST)
    public Result removeUserMenu(@RequestBody List<SysUserMenu> sysUserMenu){
        return sysUserMenuOldService.removeUserMenu(sysUserMenu);
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询用户菜单下的按钮权限
     * @Date 2022/7/4 9:45
     * @Param: userId
     * @Param: menuId
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findUserMenuButton",method = RequestMethod.GET)
    public Result findUserMenuButton(String userId,String menuId){
        return sysUserMenuOldService.findUserMenuButton(userId,menuId);
    }
}
